package com.swf.seed.util;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

import org.slf4j.Logger;

import com.swf.seed.base.DefaultLogger;

public class PropUtils {
	private static Logger logger = DefaultLogger.getLogger();
	private String charset;
	private String propFile;
	
	public PropUtils setCharset(String charset) {
		this.charset = charset;
		return this;
	}
	
	public PropUtils setPropFile(String propFile){
		this.propFile = propFile;
		return this;
	}
	
	
	public  Properties getProp(){
		 Properties props = new Properties();
    	 try {
    		logger.debug("加载配置文件："+propFile);
			props.load(new FileInputStream(propFile));
		} catch (FileNotFoundException e) {
			logger.error(e.getMessage(), e);
		} catch (IOException e) {
			logger.error(e.getMessage(), e);
		}
    	 return props;
	}
	

}
